Skip to content

[vnet] feat: serve DNS on IPv4#55539

Merged
nklaassen merged 4 commits intomasterfrom
nklaassen/vnet-ipv4-dns
Jun 23, 2025
Merged

[vnet] feat: serve DNS on IPv4#55539
nklaassen merged 4 commits intomasterfrom
nklaassen/vnet-ipv4-dns

Conversation

@nklaassen
Copy link
Copy Markdown
Contributor

@nklaassen nklaassen commented Jun 6, 2025

This PR makes VNet configure a DNS server on an IPv4 address to support clients where IPv6 is blocked. It does this by configuring an additional nameserver in the OS when VNet first assigns itself an IPv4 address once the user logs in to a cluster and we find the IPv4 CIDR range for the cluster.

Because the V4 DNS address is assigned dynamically, I updated the virtual network stack to handle DNS on UDP port 53 no matter which address it receives the request from.

changelog: Made VNet DNS available over IPv4

@github-actions github-actions Bot requested review from gabrielcorado and r0mant June 6, 2025 20:15
@nklaassen nklaassen force-pushed the nklaassen/vnet-ipv4-dns branch from 906e713 to 6d1af7a Compare June 9, 2025 22:58
@milos-teleport milos-teleport added the c-vdc Internal Customer Reference label Jun 10, 2025
@nklaassen
Copy link
Copy Markdown
Contributor Author

friendly ping @r0mant @gabrielcorado

@nklaassen nklaassen force-pushed the nklaassen/vnet-ipv4-dns branch from fd42696 to 1147334 Compare June 17, 2025 19:31
Comment thread lib/vnet/network_stack.go Outdated
// on addresses that have not been explicitly assigned to any handler yet.
// This is so the DNS server can handle UDP requests to port 53 on any IP
// address.
if err := netStack.SetPromiscuousMode(nicID, true); err != nil {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other implications to this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much, this does not effect the TUN or the host in any way, it only changes the mode on the gVisor NIC. The effect is that when gVisor receives an incoming IP packet from the host where the destination IP does not match an IP that has been explicitly assigned to the gVisor NIC, it would still call VNet's TCP or UDP handler instead of just dropping the packet. But it looks like it does assign some internal state for each unique IP used in this way so there could be some memory overhead if a client hit a ton of IPs in VNet's range.

This was always kind of a lazy way of doing this, in the latest commit i switched to explicitly assigning the address for the IPv4 DNS server and avoiding promiscuous mode.

Comment thread lib/vnet/osconfig_provider.go Outdated
Comment thread lib/vnet/network_stack.go Outdated
@nklaassen nklaassen enabled auto-merge June 23, 2025 17:13
@nklaassen nklaassen added this pull request to the merge queue Jun 23, 2025
Merged via the queue into master with commit bdb190e Jun 23, 2025
39 checks passed
@nklaassen nklaassen deleted the nklaassen/vnet-ipv4-dns branch June 23, 2025 17:54
nklaassen added a commit that referenced this pull request Jun 24, 2025
nklaassen added a commit that referenced this pull request Jun 24, 2025
nklaassen added a commit that referenced this pull request Jul 4, 2025
nklaassen added a commit that referenced this pull request Jul 4, 2025
@zmb3 zmb3 linked an issue Jul 8, 2025 that may be closed by this pull request
@zmb3 zmb3 mentioned this pull request Jul 8, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Jul 8, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Jul 8, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Jul 22, 2025
* [v17][vnet] feat: TCP dial to SSH targets

Backport #55087 to branch/v17

* [v17][vnet] feat: accept incoming SSH connections

Backport #55155 to branch/v17

* [v17][vnet] feat: forward SSH connections to target

Backport #55156 to branch/v17

* [v17][vnet] feat: write VNet SSH keys to TELEPORT_HOME

Backport #55228 to branch/v17

* [v17][vnet] feat: write OpenSSH-compatible config file for VNet SSH

Backport #55239 to branch/v17

* [v17][vnet] fix: support <hostname>.<leaf-cluster> for VNet SSH

Backport #55688 to branch/v17

* fix BlockUntil API for backport

* [v17][vnet] feat: add "Connect with VNet" button to SSH servers

Backport #55623 to branch/v17

* [v17][vnet] feat: support VNet SSH when cluster name does not match proxy public addr

Backport #55655 to branch/v17

* [v17][vnet] feat: add SSH configuration diagnostic

Backport #55594 to branch/v17

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* [v17][vnet] feat: show SSH status in VNet slider

Backport #55755 to branch/v17

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* [v17][vnet] feat: support proxy recording mode with VNet SSH

Backport #55788 to branch/v17

* [v17][vnet] feat: support diag checks on windows

Backport #55856 to branch/v17

* [v17] fix: data race in vnet.TestSSH

Backport #55980 to branch/v17

* [v17][vnet] feat: mention SSH on VNet info page

Backport #55973 to branch/v17

* [v17][vnet] feat: serve DNS on IPv4

Backport #55539 to branch/v17

* [v17][vnet] fix: close proxied channel only after data and requests are complete

Backport #56020 to branch/v17

* [v17][vnet] feat: automatic SSH client configuration

Backport #55923 to branch/v17

* VNet docs: Provide clear instructions for getting debug logs (#56068)

* VNet diag notification: Do not show button to open report if there's no workspace selected (#56067)

* VNet diag report: Don't show button in notification if there's no workspace

* Replace deprecated MutableRefObject with RefObject

* Make openReport not depend on value of rootClusterUri

Otherwise the effect that uses setInterval re-runs whenever the user
switches to another workspace.

* [v17][vnet] feat: automatic SSH client configuration in Connect

Backport #55924 to branch/v17

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>

* [v17][vnet] fix: avoid empty host matchers in generated SSH config

Backport #56103 to branch/v17

* avoid t.Context() pre go1.24

* fix cspell lint

* [v17][docs] VNet SSH

Backport #56147 to branch/v17

* [v17][vnet] feat: SSH usage reporting

Backport #56537 to branch/v17

* [v17][vnet] fix: mask default IP route on windows

Backport #56957 to branch/v17

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Jul 22, 2025
* [v18][vnet] feat: TCP dial to SSH targets

Backport #55087 to branch/v18

* [v18][vnet] feat: accept incoming SSH connections

Backport #55155 to branch/v18

* [v18][vnet] feat: forward SSH connections to target

Backport #55156 to branch/v18

* [v18][vnet] feat: write VNet SSH keys to TELEPORT_HOME

Backport #55228 to branch/v18

* [v18][vnet] feat: write OpenSSH-compatible config file for VNet SSH

Backport #55239 to branch/v18

* [v18][vnet] fix: support <hostname>.<leaf-cluster> for VNet SSH

Backport #55688 to branch/v18

* [v18][vnet] feat: add "Connect with VNet" button to SSH servers

Backport #55623 to branch/v18

* fix test in backport

* [v18][vnet] feat: support VNet SSH when cluster name does not match proxy public addr

Backport #55655 to branch/v18

* [v18][vnet] feat: add SSH configuration diagnostic

Backport #55594 to branch/v18

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* [v18][vnet] feat: show SSH status in VNet slider

Backport #55755 to branch/v18

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

* [v18][vnet] feat: support proxy recording mode with VNet SSH

Backport #55788 to branch/v18

* [v18][vnet] feat: support diag checks on windows

Backport #55856 to branch/v18

* [v18] fix: data race in vnet.TestSSH

Backport #55980 to branch/v18

* [v18][vnet] feat: mention SSH on VNet info page

Backport #55973 to branch/v18

* [v18][vnet] feat: serve DNS on IPv4

Backport #55539 to branch/v18

* [v18][vnet] fix: close proxied channel only after data and requests are complete

Backport #56020 to branch/v18

* [v18][vnet] feat: automatic SSH client configuration

Backport #55923 to branch/v18

* VNet diag notification: Do not show button to open report if there's no workspace selected (#56067)

* VNet diag report: Don't show button in notification if there's no workspace

* Replace deprecated MutableRefObject with RefObject

* Make openReport not depend on value of rootClusterUri

Otherwise the effect that uses setInterval re-runs whenever the user
switches to another workspace.

* [v18][vnet] feat: automatic SSH client configuration in Connect

Backport #55924 to branch/v18

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>

* [v18][vnet] fix: avoid empty host matchers in generated SSH config

Backport #56103 to branch/v18

* [v18][docs] VNet SSH

Backport #56147 to branch/v18

* [v18][docs] add VNet warnings

Backport #56601 to branch/v18

* [v18][vnet] feat: SSH usage reporting

Backport #56537 to branch/v18

* [v18][vnet] fix: mask default IP route on windows

Backport #56957 to branch/v18

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-vdc Internal Customer Reference size/sm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vnet] IPv4 DNS Server

4 participants